import Vue from 'vue'
import VueRouter from 'vue-router'

import login from "../components/login.vue"
import register from "../components/register.vue"

Vue.use(VueRouter)
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

const routes = [
  {
    path: "/login",
    name: "login",
    component: login
  },
  {
    path: "/register",
    name: "register",
    component: register
  },
  // {
  //   path: "*",
  //   redirect: "/"
  // }
]
const router = new VueRouter({
  mode: "history",
  base: process.env.NODE_ENV === "production" ? "/shop" : "/",
  routes
})
export default router;
